{\rtf1\ansi\deff0\adeflang1025
{\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}{\f1\froman\fprq2\fcharset0 Times New Roman;}{\f2\fswiss\fprq2\fcharset0 Arial;}{\f3\froman\fprq2\fcharset0 Times New Roman;}{\f4\fswiss\fprq2\fcharset0 Arial Unicode MS;}{\f5\fnil\fprq2\fcharset0 MS Mincho;}{\f6\fnil\fprq0\fcharset0 Tahoma;}}
{\colortbl;\red0\green0\blue0;\red128\green128\blue128;}
{\stylesheet{\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033\snext1 Normal;}
{\s2\sb240\sa120\keepn\rtlch\af2\afs28\lang255\ltrch\dbch\af5\langfe255\hich\f2\fs28\lang1033\loch\f2\fs28\lang1033\sbasedon1\snext3 Heading;}
{\s3\sa120\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033\sbasedon1\snext3 Body Text;}
{\s4\sa120\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033\sbasedon3\snext4 List;}
{\s5\sb120\sa120\rtlch\af6\afs24\lang255\ai\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\i\loch\fs24\lang1033\i\sbasedon1\snext5 caption;}
{\s6\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033\sbasedon1\snext6 Index;}
{\s7\sb120\sa120\rtlch\afs24\lang255\ai\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\i\loch\fs24\lang1033\i\sbasedon1\snext7 caption;}
}
{\info{\creatim\yr2011\mo7\dy24\hr7\min8}{\revtim\yr0\mo0\dy0\hr0\min0}{\printim\yr0\mo0\dy0\hr0\min0}{\comment StarWriter}{\vern3000}}\deftab709
{\*\pgdsctbl
{\pgdsc0\pgdscuse195\pgwsxn12240\pghsxn15840\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\pgdscnxt0 Standard;}}
{\*\pgdscno0}\paperh15840\paperw12240\margl1134\margr1134\margt1134\margb1134\sectd\sbknone\pgwsxn12240\pghsxn15840\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\ftnbj\ftnstart1\ftnrstcont\ftnnar\aenddoc\aftnrstcont\aftnstart1\aftnnrlc
\pard\plain \ltrpar\s1\ql\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 using System;}
\par \pard\plain \ltrpar\s1\ql\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 using Tesla.Core;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 using Tesla.Graphics;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 using Tesla.Math;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 using Tesla.Input;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 using Tesla.Scene;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 using Tesla.Scene.Shape;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 using Tesla.Scene.Extension;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 using Tesla.Content;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 namespace TeslaSamples.Misc \{}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch     }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 /// <summary>}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch     }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 /// Example for getting a very basic window and scene graph set up. The engine does a lot for you under the hood}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch     }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 /// in respect to the scene graph, but this example could easily be used with just a vertex buffer/effect.}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch     }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 /// </summary>}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch     }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 [AppDescription("Minimal Sample", PlatformCapabilities.Direct3D10 | PlatformCapabilities.XNA4, "MinimalImage", "MinimalDesc", "MinimalSource")]}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch     }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 public class MinimalApp : IApp \{}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Window that we'll use render our scene to}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 private Window _window;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Window host is how we'll be hosting our application.}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 private IWindowHost _host;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Renderer that provides access to the graphics device and used}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //to draw geometry}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 private IRenderer _renderer;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Timing mechanism so we can interopolate animations between frames}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 private GameTimer _timer;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Content manager that allows us to load content and cache it, so we}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //only load stuff like textures once}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 private ContentManager _content;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Root node of a scene graph that we'll attach geometry that represents our scene}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 private Node _rootNode;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 private bool _exiting;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 /// <summary>}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 /// Creates a host to run our application in and executes the "game loop"}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 /// </summary>}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 public void Run(RenderSystemPlatform platform, PresentationParameters pp) \{}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Tesla's core functionality is serviced based. A service is a module that provides access}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //to concrete implementation of engine objects. Common services are the render system, windowing, and input. They are}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //managed by the static "Engine" class, which serves as the primary point in the codebase to bring together all services.}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //The only service that is actually is needed to "Initialize" the engine is a render system, all others are optional.}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Since service providers are interfaces, you effectively de-couple their implementations from other services or code}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //that relies on them. Other than allowing for code to be cleanly separated into modules, this allows for the developer to mix-and-match}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //services. For example, if you're developing a Windows application, then you can use the SWFWindowProvider, WindowsKeyboardProvider,}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //and WindowsMouseProvider (which we use below) for your windowing/input needs. Then, different render systems such as OpenGL, D3D10,}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //or XNA can be used without any modification.}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //This modularity allows the engine to expand in the future, to include new implementations for new platforms or allow}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //the developer to create their own specific implementations. Additionally, new services can be created such as joystick or}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //gamepad support, either as a third-party addition or integrated directly into the engine core.}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //The render system is the central service for the graphics engine. Initializing}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //the engine will create default graphics content/objects (such as the standard render states)}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 Engine.Initialize(new Tesla.Direct3D10.Graphics.Renderer.D3D10RenderSystemProvider());}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //A window service provider allows us to setup native windows + the means to host them as an application.}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 Engine.Services.AddService(typeof(IWindowProvider), new Tesla.Windows.Core.SWFWindowProvider());}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Input providers should be obvious (in this case, by registering a service provider we can use the Keyboard/Mouse static classes)}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 Engine.Services.AddService(typeof(IKeyboardProvider), new Tesla.Windows.Input.WindowsKeyboardProvider());}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 Engine.Services.AddService(typeof(IMouseProvider), new Tesla.Windows.Input.WindowsMouseProvider());}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Get the renderer so we don't have to keep querying the render system (there is only ever one renderer, similar}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //to how there's only ever one Device in Direct3D)}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 _renderer = Engine.Services.GetService<IRenderSystemProvider>().Renderer;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Setup your game window. Since it's set to primary window, a form will be created. Non-primary creates}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //a control that can be added to a a windows form app (e.g. editor and such)}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 _window = new Window(pp, true);}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 _window.AllowUserResizing = true;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 _window.IsMouseVisible = true;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 _window.Title = "Minimal Sample";}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Create a camera - if you resize the window, make sure you update your camera's viewport and projection!}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 Camera camera = new Camera(new Viewport(0, 0, pp.BackBufferWidth, pp.BackBufferHeight));}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 camera.Position = new Vector3(0, 0, 100f);}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 camera.SetProjection(45.0f, 1.0f, 30000.0f);}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 camera.Update();}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Set the camera onto the renderer. This can be considered the "active" camera, which would}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //be used if you draw the scene graph (first there is a culling pass). Setting the current camera}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //also sets the viewport onto the device}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 _renderer.CurrentCamera = camera;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //To resize the camera we can add an event handler to the window. If we shrink/grow the window,}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //we need to reset the camera's viewport and projection too.}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 _window.ClientSizeChanged += new EventHandler(delegate(Object sender, EventArgs args) \{}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch                 }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 Rectangle rect = _window.ClientBounds;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch                 }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 camera.Viewport = new Viewport(0, 0, rect.Width, rect.Height);}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch                 }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 camera.SetProjection(45.0f, 1.0f, 30000.0f);}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch                 }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 camera.Update();}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch                 }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Set the viewport onto the renderer - if we set the renderer.CurrentCamera property, this would be taken care of too.}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch                 }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 _renderer.Viewport = camera.Viewport;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 \});}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Create a content manager - this allows us to load & cache assets. Very similar to XNA's way of doing content loading.}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Every renderer has a manager for default content (currently the shader library), for platform-specific content.}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Content managers only have the binary/material loaders registered, and all others (image, model loaders) must be registered.}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //You can also use content managers to divide up your assets into logical groups, }
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 _content = new ContentManager();}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Load content}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 LoadContent();}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Create and start the timer we'll use for update calls}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 _timer = new GameTimer();}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Engine values are common properties such as the World-View-Projection matrices, the Camera, or the timer. You can}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //tell the material to query these values, which it will automatically every frame. The value map only needs 3 inputs:}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 // 1. World Matrix - Set your world matrix to it before calling properties that may require it (such as a World-View-Projection)}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 // 2. Timer - Set your timer before calling timing properties (time per frame, fps, etc)}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 // 3. Camera - Set your current camera before calling any camera related properties (such as World-View-Projection)}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //When you set the camera to the renderer (renderer.CurrentCamera), #3 is automatically taken care of. The scenegraph takes}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //care of #1. When you setup your application, you have to set #2 yourself (as we do here). If you create your own mesh classes/scene graph,}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //be aware of #1.}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 Engine.ValueMap.Timer = _timer;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 _timer.Start();}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Create a host for the window (only for primary windows), if you're familiar with Application.Run(), our SWF host is effectively that!}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 _host = Engine.Services.GetService<IWindowProvider>().CreateWindowHost(_window);}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //The "game loop", which is called when the application is idle}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 _host.Idle += new EventHandler(Loop);}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Run the app}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 _host.Run();}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Ensure we dismiss the services and clean up the resources created, when we fall out of our loop.}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 Engine.CleanUpResources();}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 \}}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Loadup our content}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 private void LoadContent() \{}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Create a root node}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 _rootNode = new Node("Scene");}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Simple point light}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 PointLight pl = new PointLight();}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 pl.Attenuate = false;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 pl.Position = new Vector3(-20, 0, 20); //Put the light in the lower-left corner of the screen for this example}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 _rootNode.AddLight(pl);}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Create a rotating box}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 Box box = new Box("Mybox", 10, 10, 10);}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Set it 10 units down the -Z-axis}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 box.Translation = new Vector3(0, 0, -10);}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Add a controller that rotates it 25 degrees per second. This is updated every time the scene graph is updated.}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 box.AddController(new RotateController(Vector3.UnitX, 25));}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Create a material for the box, make sure we clone it otherwise we reuse the cached object}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 box.Material = _content.Load<Material>("LitBasicColor.tem").Clone();}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Set a red diffuse color to the effect parameter}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 box.Material.SetParameter("MatDiffuse", Color.DarkRed.ToVector3());}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Note on materials: You can programmatically create them, or define them in material files (.tem). Material files}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //can inherit from another, and you're able to set parameters, render states, and engine values. A benefit of TEM files}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //is that because you're describing them in a plain-text file, you can actually change how your objects are rendered without}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //writing code or re-compiling your application. They also serve as templates to streamline your content creation, since a lot}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //of your geometry may use the same material, or most of the same material (e.g. a color or texture change).}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 _rootNode.AddChild(box);}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 \}}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 private void UnloadContent() \{}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //We can unload all the content that is currently cached by the content manager. Although we do so when we're exiting the app,}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //this can be done when levels are changed.}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 _content.Unload();}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 \}}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //The game loop}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 private void Loop(object sender, EventArgs e) \{}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //If we aren't exiting, continue}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 if(!_exiting) \{}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch                 }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Advance the timer}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch                 }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 GameTime time = _timer.Update();}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch                 }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Check inputs}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch                 }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 CheckInput(time);}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch                 }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Update scene}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch                 }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 Update(time);}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch                 }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Draw scene}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch                 }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 Draw(_renderer);}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch                 }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Otherwise start the exit & cleanup resources}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 \} else \{}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch                 }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Dismiss loaded content}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch                 }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 UnloadContent();}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch                 }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Notifies the application it is exiting}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch                 }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 _host.Exit();}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch                 }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Ensure we dismiss the services and clean up the resources they created.}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch                 }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 Engine.CleanUpResources();}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 \}}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 \}}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Check input, update camera}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 private void CheckInput(GameTime time) \{}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Tell the app to exit if escape is pushed.}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 KeyboardState ks = Keyboard.GetKeyboardState();}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 if(ks.IsKeyDown(Keys.Escape)) \{}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch                 }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 _exiting = true;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 \}}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 _renderer.CurrentCamera.Update();}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 \}}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Update portion of loop}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 private void Update(GameTime time) \{}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Do your updating here}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 _rootNode.Update(time);}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 \}}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Draw portion of loop}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 private void Draw(IRenderer renderer) \{}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Every window has a backbuffer associated with it called a swap chain. Before we render anything to it, we first}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //must clear it. So we can have multiple windows for only one device; you clear/draw/present to each window you}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //want your scene to be rendered upon (useful for multiple views in a tool, for instance).}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 _window.SwapChain.Clear(Color.CornflowerBlue);}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Do your rendering here}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 _rootNode.Draw(renderer);}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Flush any remaining geometries in our render queue, which renders them}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 renderer.RenderQueue.SortRenderClear();}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 //Present to the window}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 _window.SwapChain.Present();}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 \}}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch     }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 \}}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af4\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0 \}}
\par }